package com.ywl.exercise.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.ywl.exercise.dao.BaseDao;
import com.ywl.exercise.dao.UserDao;
import com.ywl.exercise.entity.UserEntity;



@Repository
public class UserDaoImpl extends BaseDao<UserEntity> implements UserDao {

	@Override
	public void saveUser(UserEntity entity) {
		super.save(entity);
	}

	@Override
	public void updateUser(UserEntity entity) {
		super.update(entity);
	}

	@Override
	public UserEntity findUserByLoginId(String loginid) {
		Query q = createQuery("from UserEntity u where u.loginid =?", loginid);
		q.setMaxResults(1);
		return (UserEntity)q.uniqueResult();
	}
}
